// pages/business/buspersonal/buspersonal.js
var utils = require('../../../utils/util.js');
var app=getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var that=this;
        that.groupgoodsDetail();
    },
    groupgoodsDetail: function (id) {
        var that = this;
        utils.showLoading();
        utils.http("/api/v1/Storemanage/store_info", {
            store_id: wx.getStorageSync("userType").storeid,
        }, function (res) {
            utils.hideLoading();
            that.setData({
                data: res.datas,
            })
        })
    },
    //商品
    onBusinessTap: function (e) {
        wx.reLaunch({
            url: '../../business/business',
        })
    },
    //订单
    onorderTap: function (e) {
        wx.reLaunch({
            url: '../order/order',
        })
    },
    //批发商品
    onWholesaleTap:function(e){
        wx.navigateTo({
            url: '../wholesale/wholesale',
        })
    },
    //批发订单
    wholesaleOrder:function(e){
        wx.navigateTo({
            url: '../../wholesaleOrder/wholesaleOrder',
        })
    },
    //发布管理
    ReleasemanagementTap:function(e){
        wx.navigateTo({
            url: '../releasemanagement/releasemanagement',
        })
    },
    //销售额记录
    onAmountTap:function(e){
        wx.navigateTo({
            url: '../../saleroom/saleroom',
        })
    },
    //积分页面
    myLntegralTap:function(e){
        wx.navigateTo({
            url: '/pages/myIntegralLog/myIntegralLog?type=2',
        })
    },
    butareaHover: function (e) {
        var that = this;
        wx.scanCode({
            success: (res) => {
                var resList=res.result.split("@");
                    console.log(resList[0]);
                console.log(resList[1]);
                utils.http("/api/v1/storemanage/write_off",{
                    order_id: resList[0],
                    verification: resList[1],
                    store_id: wx.getStorageSync("userType").storeid,
                },function(res){
                    if (res.state==1){
                        wx.showToast({
                            title: '扫码核销成功，已确认收货',
                        })
                    }else{
                        utils.message(res.datas);
                    }
                })
            }
        })
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})